<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateParticipantTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('participant', function (Blueprint $table) {
//            $table->comment('跟activity_info关联');
            $table->bigInteger('id', true);
            $table->bigInteger('activity_info_id')->nullable()->index('aid_idx')->comment('活动主数据表');
            $table->string('activity_category', 255)->nullable()->index('activity_category_idx')->comment('数据类型 目前直接用FormKeyEnum 的主form的key');
            $table->bigInteger('user_id')->nullable()->comment('userId数据');
            $table->string('participant_type', 255)->nullable()->comment('参与类型：主持人/参与人');
            $table->string('name', 255)->nullable()->comment('活动名称/课程名称等');
            $table->text('proof_material')->nullable()->comment('证明材料');
            $table->bigInteger('form_instance_id')->nullable()->comment('formInstanceId');
            $table->integer('deleted')->nullable()->default(0)->comment('是否被删除');
            $table->timestamp('created_at')->nullable()->useCurrent();
            $table->timestamp('updated_at')->useCurrentOnUpdate()->nullable()->useCurrent();
            $table->bigInteger('creator_id')->nullable();
            $table->bigInteger('updater_id')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('participant');
    }
};
